<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of SentimentWords
 *
 * @author QuangKhoi
 */
class SentimentWords {
    public $words;
    
    private static $instance;
    
    public function __construct() {
        if ($words === null)
            $words = self::getWords();
    }
    
    public static function getWords() {
        $db = Database::getInstance();
        $result = $db->query("SELECT * FROM `sentimentwords`");
        if ($result->returnCode == 200) {
            $words = array();
            foreach($result->dataTable->rows as $row) {
                $words[] = $row;
            }
            return $words;
        }
    }
    
    public static function getInstance() {
        if ($instance == null) {
            $instance = new self();
        }
        return $instance;
    }
}

?>
